// 最近一次调整的数据状态
const auditStatusList = [
  {
    value: 'DRAFT',
    label: '待提交'
  },
  {
    value: 'SUBMITTED',
    label: '审核中'
  },
  {
    value: 'REJECTED',
    label: '审核不通过'
  },
  {
    value: 'PAST',
    label: '审核通过'
  }
]

// 节点状态
const nodeStatusList = [
  {
    value: 0,
    label: '未开始'
  },
  {
    value: 1,
    label: '正进行'
  },
  {
    value: 2,
    label: '逾期未完成'
  },
  {
    value: 3,
    label: '按期完成'
  },
  {
    value: 4,
    label: '逾期完成'
  }
]

// 搜索项
const searchOption = [
  {
    name: '业务事项',
    value: 'businessMatters',
    type: 'input'
  },
  {
    name: '节点状态',
    value: 'nodeStatus',
    type: 'select',
    data: nodeStatusList
  },
  {
    name: '计划完成时间',
    value: 'plannedCompletionTime',
    type: 'dateRange',
    attr: {
      rangeFormat: ['planEndTimeBegin', 'planEndTimeOver']
    }
  },
  // {
  //   name: '是否合同节点',
  //   value: 'isContractDurationNode',
  //   type: 'select',
  //   data: [
  //     {
  //       value: true,
  //       label: '是'
  //     },
  //     {
  //       value: false,
  //       label: '否'
  //     }
  //   ]
  // },
  {
    name: '最近一次调整的数据状态',
    value: 'auditStatus',
    type: 'select',
    data: auditStatusList
  }
]
// 表头
const columns = [
  {
    title: '序号',
    width: 80,
    align: 'center',
    customRender: (text, record, index) => {
      return index + 1
    }
  },
  {
    title: '分公司',
    width: 180,
    dataIndex: 'branchComName'
  },
  {
    title: '项目部',
    width: 260,
    dataIndex: 'projectName'
  },
  {
    title: '阶段/类别',
    width: 260,
    dataIndex: 'stageCategory'
  },
  {
    title: '业务事项',
    width: 200,
    dataIndex: 'businessMatters'
  },
  {
    title: '管控级别',
    width: 80,
    dataIndex: 'controlLevel'
  },
  {
    title: '计划开始时间',
    width: 120,
    dataIndex: 'planStartTime'
  },
  {
    title: '计划完成时间',
    width: 120,
    dataIndex: 'planEndTime'
  },
  // {
  //   title: '是否合同节点',
  //   width: 120,
  //   dataIndex: 'isContractDurationNode',
  //   customRender: (text, record, index) => {
  //     return text ? '是' : '否'
  //   }
  // },
  // {
  //   title: '合同开始时间',
  //   width: 120,
  //   dataIndex: 'contractStartDate'
  // },
  // {
  //   title: '合同完成时间',
  //   width: 120,
  //   dataIndex: 'contractEndDate'
  // },
  {
    title: '节点状态',
    width: 160,
    dataIndex: 'nodeStatus',
    customRender: (text, record, index) => {
      return nodeStatusList.find(el => el.value == text)?.label || ''
    }
  },
  {
    title: '当前逾期次数',
    width: 120,
    dataIndex: 'warningNum'
  },
  {
    title: '最近一次调整后计划完成时间',
    width: 160,
    dataIndex: 'adjustCompletionTime'
  },
  {
    title: '最近一次调整的数据状态',
    width: 160,
    dataIndex: 'auditStatus',
    customRender: (text, record, index) => {
      return auditStatusList.find(el => el.value === text)?.label || ''
    }
  },
  {
    title: '操作',
    dataIndex: 'operation',
    width: 200,
    fixed: 'right',
    scopedSlots: { customRender: 'operation' }
  }
]

// 操作表单项(总计划)
const detailFormOption = [
  {
    label: '所属单位',
    keyName: 'projectId',
    type: 'orgTree',
    span: 16,
    isAutoSelectFirst: true,
    isNeedAuth: true,
    checkStrictly: true,
    disabled: true
  },
  {
    label: '创建时间',
    keyName: 'createTime',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '阶段类别',
    keyName: 'stageCategory',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '业务事项',
    keyName: 'businessMatters',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '管控级别',
    keyName: 'controlLevel',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '是否里程碑节点',
    keyName: 'isMilestonesNode',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '是否关键线路节点',
    keyName: 'isKeyNode',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '计划开始时间',
    keyName: 'planStartTime',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '计划完成时间',
    keyName: 'planEndTime',
    type: 'BaseInput',
    disabled: true
  },
  // {
  //   label: '是否合同节点',
  //   keyName: 'isContractDurationNode',
  //   type: 'BaseInput',
  //   disabled: true,
  // },
  // {
  //   label: '合同开始时间',
  //   keyName: 'contractStartDate',
  //   type: 'BaseInput',
  //   disabled: true
  // },
  // {
  //   label: '合同完成时间',
  //   keyName: 'contractEndDate',
  //   type: 'BaseInput',
  //   disabled: true
  // },
  {
    label: '节点状态',
    keyName: 'nodeStatus',
    type: 'BaseInput',
    disabled: true
  }
]

// 节点预警信息表头
const detailColumns = [
  {
    title: '逾期次数',
    width: 100,
    align: 'center',
    dataIndex: 'warningNum'
  },
  {
    title: '逾期原因',
    dataIndex: 'typeName',
    scopedSlots: { customRender: 'typeName' }
  },
  {
    title: '调整后计划完成时间',
    width: 160,
    align: 'center',
    dataIndex: 'adjustCompletionTime'
  },
  {
    title: '保障措施',
    dataIndex: 'measure'
  },
  {
    title: '工期顺延报告',
    width: 400,
    dataIndex: 'periodDelayFileList',
    scopedSlots: { customRender: 'periodDelayFileList' }
  },
  {
    title: '创建人',
    width: 120,
    align: 'center',
    dataIndex: 'creatorName'
  },
  {
    title: '创建时间',
    width: 120,
    align: 'center',
    dataIndex: 'createTime'
  },
  {
    title: '状态',
    width: 100,
    align: 'center',
    dataIndex: 'auditStatus',
    customRender: (text, record, index) => {
      return auditStatusList.find(el => el.value === text)?.label || record.auditStatusName
    }
  },
  {
    title: '操作',
    dataIndex: 'operation',
    width: 150,
    align: 'center',
    scopedSlots: { customRender: 'operation' }
  }
]

// 节点预警信息编辑表单项
const updateFormOption = [
  {
    label: '逾期原因',
    keyName: 'typeId',
    slot: true,
    span: 24,
    replaceFields: {
      children: 'children',
      title: 'title',
      key: 'value',
      value: 'value'
    },
    rules: [{ required: true, message: '请选择', trigger: 'change' }]
  },
  // {
  //   keyName: 'deptPrincipalId',
  //   viewName: 'deptPrincipalName',
  //   label: '督办部门负责人',
  //   type: 'a-select',
  //   data: this.deptPrincipalData,
  //   replaceFields: {
  //     value: 'userId', // 默认为value
  //     label: 'name' // 默认为label
  //   },
  // },
  {
    label: '调整后计划完成时间',
    keyName: 'adjustCompletionTime',
    slot: true,
    rules: [{ required: true, message: '请选择', trigger: 'change' }]
  },
  {
    label: '保障措施',
    keyName: 'measure',
    type: 'BaseTextarea',
    span: 24,
    attrs: {
      maxLength: 3000
    },
    rules: [{ required: true, message: '请输入', trigger: 'change' }]
  },
  {
    label: '工期顺延报告',
    keyName: 'periodDelayFileList',
    type: 'uploadFile',
    span: 24,
    businessCode: 'PM51',
    // attrs:{
    //   count: 9
    // },
    rules: [{ required: true, message: '请上传工期顺延报告', trigger: 'change' }]
  },
]


// 操作竣工收尾表单项(总计划)
const jGdetailFormOption = [
  {
    label: '所属单位',
    keyName: 'projectId',
    type: 'orgTree',
    span: 16,
    isAutoSelectFirst: true,
    isNeedAuth: true,
    checkStrictly: true,
    disabled: true
  },
  {
    label: '创建时间',
    keyName: 'createTime',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '阶段类别',
    keyName: 'stageCategory',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '业务事项',
    keyName: 'businessMatters',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '管控级别',
    keyName: 'controlLevel',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '计划开始时间',
    keyName: 'planStartTime',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '计划完成时间',
    keyName: 'planEndTime',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '节点状态',
    keyName: 'nodeStatus',
    type: 'BaseInput',
    disabled: true
  }
]

export { searchOption, columns, detailFormOption, detailColumns, auditStatusList, nodeStatusList, updateFormOption,jGdetailFormOption}
